package com.zoe.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Author Zoe.Zhang
 * @Date: 2021/07/03
 * @Description $description
 */
@WebServlet(name = "HelloServlet", value = "/hello")
public class HelloServlet extends javax.servlet.http.HttpServlet {
    @Override
    public void destroy() {
        System.out.println("servlet destroy");
    }

    @Override
    public void init() throws ServletException {
        System.out.println("servlet init");
    }

    @Override
    protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        System.out.println("dopost");

        PrintWriter writer = response.getWriter();
        writer.write("窝窝头一块钱四个~~");
        writer.write("<a href='index.jsp'>去登录</a>");
        writer.flush();

    }

    @Override
    protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        doPost(request, response);
    }
}
